package com.tanhua.autoconfig;

import com.tanhua.autoconfig.properties.*;
import com.tanhua.autoconfig.templates.*;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * @program: tanhua
 * @description:
 * @author: MR.peng
 * @create: 2022-03-06 01:09
 **/
//开启Smsproperties配置对象的使用
@EnableConfigurationProperties(
        value = {Smsproperties.class, //查找配置文件，封装对象，存入容器
                 OssProperties.class,
                AipFaceProperties.class,
                HuanXinProperties.class,
                GreenProperties.class

        }
)//相当于在Smsproperties上加了@Component
public class TanhuaAutoConfiguration {

    @Bean
    public SmsTemplate smsTemplate(){
        return new SmsTemplate();
    }

    @Bean
    public OssTemplate ossTemplate(){
        return new OssTemplate();
    }

    @Bean
    public AipFaceTemplate aipFaceTemplate(){
        return new AipFaceTemplate();
    }

    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties properties) {
        return new HuanXinTemplate(properties);
    }

    @Bean
    public AliyunGreenTemplate aliyunGreenTemplate(GreenProperties properties){
        return new AliyunGreenTemplate(properties);
    }
}
